import deliveryApi from '@/config/server/api/order.js'
import dt from '@dt/dt'

function deliveryListInfos(params) {
  return deliveryApi.delivery.selectHandoverList.fetch(params).then((res) => {
    return res
  })
}
//合同信息数据模板
function exportBargain(params) {
  params.fileName = '合同信息数据模板.xls'
  return deliveryApi.delivery.exportBargain.fetch(params).then((res) => {
    console.log(res)
  })
}

//交房信息数据模版
function exportHandover(params) {
  params.fileName = '交房信息数据模版.xls'
  return deliveryApi.delivery.exportHandover.fetch(params).then((res) => {
    console.log(res)
  })
}

function selectImportRecordsListData(params) {
  return deliveryApi.delivery.selectImportRecordsList.fetch(params)
}

function exportImportRecord(params) {
  return deliveryApi.delivery.exportImportRecord.fetch(params)
}
// 上传交房信息
function importHandover() {
  let data = {
    housesId: dt.buildInfo().housesId
  }
  let upload = deliveryApi.delivery.importHandover
  upload.setData(data)
  return upload
}
// 上传交房信息
function importBargain() {
  let data = {
    housesId: dt.buildInfo().housesId
  }
  let upload = deliveryApi.delivery.importBargain
  upload.setData(data)
  return upload
}

function exportHandoverList(params) {
  return deliveryApi.delivery.exportHandoverList.fetch(params)
}

export default {
  deliveryListInfos,
  exportBargain,
  selectImportRecordsListData,
  exportImportRecord,
  importHandover,
  importBargain,
  exportHandoverList,
  exportHandover
}